local extension = Package:new("test1")
extension.extensionName = "aj_test"

local U = require "packages/utility/utility"
Fk:loadTranslationTable{
  ["test1"] = "测试·一",
}

local kaituozhehuimie = General:new(extension, "test1__kaituozhehuimie", "test_hui", 4)

local leiji = fk.CreateActiveSkill{
  name = "test1__leiji",
  prompt = "#test1__leiji",
  can_use = function(self, player)
    return player:getMark("test1__leiji-turn") == 0 and not player:isKongcheng()
  end,
  card_filter = function (self,to_select,selected,player)
    return #selected == 0 and Fk:currentRoom():getCardArea(to_select) == Player.Hand
  end,
  min_target_num = 1,
  min_card_num = 1,
  target_filter = function (self, to_select, selected, selected_cards, card, extra_data, player)
    local t = Fk:currentRoom():getPlayerById(to_select)
    return #selected == 0 and player:canPindian(t) and #t:getPile("test1__leiji") == 0
  end,
  on_use = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    local target = room:getPlayerById(effect.tos[1])
      local pindian = player:pindian({target}, self.name, Fk:getCardById(effect.cards[1]))
      if pindian.results[target.id].winner == player then
        if target:isKongcheng() then return end
        local c = Fk:getCardById(room:askForCardChosen(player,target,"he",self.name))
        target:addToPile("test1__leiji", c, true, self.name, player.id)
      else
        local u = U.askForUseVirtualCard(room,player,"duel",nil,self.name,"#test1__leiji-ask",true,false,false,false,{exclusive_targets = {target.id}})
        if u == nil then
          room:drawCards(player,1,self.name)
        end
        room:setPlayerMark(player,"test1__leiji-turn",1)
      end
  end,
  on_lose = function (self, player, is_death)
    for _, p in ipairs(player.room:getOtherPlayers(player)) do
      if #p:getPile("test1__leiji") > 0 then
        player.room:moveCardTo(p:getPile("test1__leiji"), Card.DiscardPile, nil, fk.ReasonJustMove, "test1__leiji","test1__leiji",true,p.id)
      end
    end
  end,
}

local quansheng = fk.CreateTriggerSkill{
  name = "test1__quansheng",
  events ={fk.Damage},
  can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(self.name) and 
      data.from and data.from == player and
      #data.to:getPile("test1__leiji") > 0
  end,
  --[[
  on_cost = function(self, event, target, player, data)
    local t,use = player.room:askForUseActiveSkill(player,leiji.name,"#test1__quansheng",true,{skipUse = true})
    self.cost_data = {use = use}
    return t
  end,
  --]]
  on_use = function(self, event, target, player, data)
    local room = player.room   
    room:loseHp(player,1,self.name)
    if not player.dead then
      --[[
      local use = self.cost_data.use
      leiji:onUse(room,{
        from = player.id,
        cards = use.cards,
        tos = use.targets,
      })
      for _, t in ipairs(room:getAlivePlayers()) do
        for _, c in ipairs(t:getPile("test1__leiji")) do
          room:obtainCard(player,c,true,fk.ReasonJustMove,player.id)
        end
      end--]]
      for _, t in ipairs(room:getAlivePlayers()) do
        for _, c in ipairs(t:getPile("test1__leiji")) do
          room:obtainCard(player,c,true,fk.ReasonJustMove,player.id)
        end
      end
      player.room:askForUseActiveSkill(player,leiji.name,"#test1__leiji",true)
    end
  end,
}

kaituozhehuimie:addSkill(leiji)
kaituozhehuimie:addSkill(quansheng)

Fk:loadTranslationTable{
  ["test1__kaituozhehuimie"] = "开拓者·毁灭",--名字
  ["#test1__kaituozhehuimie"] = "星尘王牌",--称号
  ["designer:test1__kaituozhehuimie"] = "zuozhe",--作者
  ["cv:test1__kaituozhehuimie"] = "cv",--cv
  ["illustrator:test1__kaituozhehuimie"] = "huashi",--画师

  ["test1__leiji"] = "垒击",
  [":test1__leiji"] = "出牌阶段，你可与一名武将牌上没有牌的角色拼点：若你赢，你将该角色的一张牌明置于其武将牌上；若你没赢，你可以摸一张牌或视为对其使用一张【决斗】，然后本回合此技能失效。",
  ["test1__quansheng"] = "全胜",
  --[":test1__quansheng"] = "当你造成伤害后，若目标武将牌上有“垒击”牌，你可以失去一点体力并发动一次“垒击”，然后获得全场武将牌上的“垒击”牌。",
  [":test1__quansheng"] = "当你造成伤害后，若目标武将牌上有“垒击”牌，你可以失去一点体力并获得全场武将牌上的“垒击”牌，然后你可以发动一次“垒击”。",

  --["#test1__quansheng"] = "全胜：你可以失去1点体力后发动【垒击】",

  ["test1__leiji-turn"] = "垒击",
  ["#test1__leiji"] = "垒击：你可以与一名没有“<b>垒击</b>”牌的角色拼点",
  ["#test1__leiji-ask"] = "垒击：你可以视为对其使用一张【决斗】或取消后摸一张牌",
  
  ["$test1__leiji1"] = "尝尝这个！",
  ["$test1__leiji2"] = "轮到你了。",
  ["$test1__quansheng1"] = "规则，就是用来打破的。",
  ["$test1__quansheng2"] = "致胜一击！",


  ['~test1__kaituozhehuimie'] = '是我…输了……',
}

local danheng = General:new(extension, "test1__danheng", "test_lie", 4)

local shuofeng = fk.CreateActiveSkill{
  name = "test1__shuofeng",
  prompt = "#test1__shuofeng",
  anim_type = "drawcard",
  min_card_num = 1,
  target_filter = Util.FalseFunc,
  card_filter = function (self, to_select, selected, player)
    return #selected == 0 and Fk:getCardById(to_select).name == "jink"
  end,
  can_use = function(self, player)
    return player:getMark("test1__shuofeng_jink-turn") ~= 0 and not player:isKongcheng()
  end,
  on_use = function(self, room, effect)
    room:recastCard(effect.cards, room:getPlayerById(effect.from), self.name)
  end,
}

local shuofeng_trigger = fk.CreateTriggerSkill{
  name = "#test1__shuofeng_trigger",
  events ={fk.EventPhaseStart},
  can_trigger = function(self, event, target ,player, data)
    return player:hasSkill(self) and target == player and player.phase == Player.Start
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local ps = room:askForChoosePlayers(player,table.map(room:getAlivePlayers(),Util.IdMapper),
    1,1,"#test1__shuofeng-xuan",self.name)
    if #ps > 0 then
      self.cost_data = {p = ps[1]}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local t = room:getPlayerById(self.cost_data.p)
    if room:askForSkillInvoke(t,self.name,nil,"#test1__shuofeng-ask:"..player.id) then
      room:setPlayerMark(t,"@test1__shuofeng-turn","jink")
      room:setPlayerMark(player,"test1__shuofeng_jink-turn","jink")
    else
      room:setPlayerMark(t,"@test1__shuofeng-round","slash")
    end
  end,
}

local shuofeng_prohibit = fk.CreateProhibitSkill{
  name = "#test1__shuofeng_prohibit",
  prohibit_use = function(self, player, card)
    return (player:getMark("@test1__shuofeng-round") ~= 0 and
    card.trueName == player:getMark("@test1__shuofeng-round")) or
    (player:getMark("@test1__shuofeng-turn") ~= 0 and
    card.name == player:getMark("@test1__shuofeng-turn"))
  end,
}

local jiyu = fk.CreateTriggerSkill{
  name = "test1__jiyu",
  events ={fk.TargetSpecified},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self) and data.card.trueName == "slash" and data.from == player.id and
    #AimGroup:getAllTargets(data.tos) == 1 and 
    (player:usedSkillTimes(self.name) <= player:getMark("test1__jiyu-turn")) then
      local t = Fk:currentRoom():getPlayerById(data.tos[1][1])
      if t:isKongcheng() then return end
      return #player.room.logic:getEventsOfScope(GameEvent.UseCard, 2, function(e)
        local use = e.data[1]
        return use.card.trueName == "slash" and use.from == player.id 
        and table.contains(TargetGroup:getRealTargets(use.tos),t.id)
      end,  Player.HistoryTurn) == 1
    end
    --[[  第一版
    return player:hasSkill(self) and data.card.trueName == "slash" and data.from == player.id and
      #AimGroup:getAllTargets(data.tos) == 1 and player:usedSkillTimes(self.name) == 0
      and not Fk:currentRoom():getPlayerById(data.tos[1][1]):isKongcheng()
    --]]
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(data.tos[1][1])
    U.viewCards(player, to:getCardIds("h"), self.name, "#test1__jiyu-view::"..to.id)
    --[[
    local all = {"#test1__jiyu-e"}
    if not data.card:isVirtual() then
      table.insert(all,"#test1__jiyu-d")
    end
    --]]
    local all = {"#test1__jiyu-e","#test1__jiyu-d"}
    local choice = room:askForChoice(player,all,self.name)
    if choice == "#test1__jiyu-e" then
      data.additionalEffect = (data.additionalEffect or 0) + 1
    else
      room:addPlayerMark(player, "test1__jiyu-turn")
      room:addPlayerMark(player, MarkEnum.SlashResidue.."-turn")
    end
  end,
  --[[
  refresh_events = {fk.CardUseFinished},
  can_refresh = function(self, event, target, player, data)
    if player:hasSkill(self) and target == player and not player.dead and data.card.trueName == "slash" and 
    player:getMark("test1__jiyu") > 0 and data.from == player.id then
        local cards = Card:getIdList(data.card)
        return #cards > 0 and table.every(cards, function(id) return target.room:getCardArea(id) == Card.Processing end)
    end
  end,
  on_refresh = function(self, event, target, player, data)
    player.room:obtainCard(player, data.card, true, fk.ReasonJustMove)
  end,
  --]]
}

local jiyu_qc = fk.CreateTriggerSkill{
  name = "#test1__jiyu_qc",
  refresh_events = {fk.CardUsing},
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(self) and target == player and not player.dead and data.card.trueName == "slash" and 
    player:getMark("test1__jiyu") > 0 and data.from == player.id
  end,
  on_refresh = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "test1__jiyu",0)
  end,
}

local jiyu_mubiao = fk.CreateTargetModSkill{
  name = "#test1__jiyu_mubiao",
  mute = true,
  bypass_times = function (self, player, skill, scope, card, to)
    return skill.trueName == "slash_skill" and player:getMark("test1__jiyu") > 0
  end,
  bypass_distances =  function(self, player, skill)
    return skill.trueName == "slash_skill" and player:getMark("test1__jiyu") > 0
  end,
}

shuofeng:addRelatedSkill(shuofeng_prohibit)
shuofeng:addRelatedSkill(shuofeng_trigger)
danheng:addSkill(shuofeng)
--jiyu:addRelatedSkill(jiyu_qc)
--jiyu:addRelatedSkill(jiyu_mubiao)
danheng:addSkill(jiyu)

Fk:loadTranslationTable{
  ["test1__danheng"] = "丹恒",--名字
  ["#test1__danheng"] = "须绳缚身",--称号
  ["designer:test1__danheng"] = "zuozhe",--作者
  ["cv:test1__danheng"] = "cv",--cv
  ["illustrator:test1__danheng"] = "huashi",--画师

  ["test1__shuofeng"] = "朔风",
  [":test1__shuofeng"] = "准备阶段，你可以令一名角色选择一项：1.其本回合不能使用【闪】，你本回合可以重铸【闪】；2.其本轮不能使用【杀】。",
  ["test1__jiyu"] = "疾雨",
  --[":test1__jiyu"] = "每回合限一次，当你使用【杀】指定唯一目标后，你可以观看其手牌并选择一项：1.此【杀】额外结算一次；2.结算后收回此【杀】的实体牌，下一张【杀】不计入次数且无次数距离限制。",
  [":test1__jiyu"] = "每回合限一次，当你使用【杀】指定唯一目标后，若你本回合未对其使用过【杀】，你可以观看其手牌并选择一项：1.此【杀】额外结算一次；2.本回合此技能及【杀】的使用次数+1。",
 
  ["#test1__jiyu_mubiao"] = "疾雨",
  ["#test1__jiyu_qc"] = "疾雨",

  ["#test1__jiyu-e"] = "此【杀】额外结算一次",
  --["#test1__jiyu-d"] = "结算后收回此【杀】，下一张【杀】无条件限制",
  ["#test1__jiyu-d"] = "本回合此技能及【杀】的使用次数+1",


  ["#test1__jiyu-view"] = "疾雨：观看%dest的手牌",

  ["@test1__shuofeng-turn"] = "朔风禁用",
  ["test1__shuofeng_jink-turn"] = "朔风",
  ["@test1__shuofeng-round"] = "朔风禁用",
  ["#test1__shuofeng-xuan"] = "朔风：你可以令一名角色进行“朔风”选择",
  ["#test1__shuofeng"] = "朔风：你可以重铸一张【闪】",
  ["#test1__shuofeng-ask"] = "朔风：你可以令你本回合不能使用【闪】且%src可以重铸【闪】，或取消后你本轮不能使用【杀】",
  
  ["#test1__shuofeng_trigger"] = "朔风",
  ["#test1__shuofeng_prohibit"] = "朔风",

  ["$test1__shuofeng1"] = "我无意挑起争端。",
  ["$test1__shuofeng2"] = "争斗…并无意义。",
  ["$test1__jiyu1"] = "生死虚实，一念之间。",
  ["$test1__jiyu2"] = "洞天幻化，长梦一觉…",
  ["$test1__jiyu3"] = "就是现在！",


  ['~test1__danheng'] = '这…不可能……',
}

local jizi = General:new(extension, "test1__jizi", "test_shi", 3,3, General.Female)

local xingpao = fk.CreateTriggerSkill{
  name = "test1__xingpao",
  events ={fk.EventPhaseStart},
  can_trigger = function(self, event, target ,player, data)
    return player:hasSkill(self) and target == player and player.phase == Player.Start
  end,
  on_cost = function (self, event, target, player, data)
    local n = #player.room:askForDiscard(player,1,3,true,self.name,true,nil,"#test1__xingpao")
    self.cost_data = {n = n}
    return n > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = self.cost_data.n
    if n > 0 then
      local choices = room:askForChoices(player,{"test1__xingpao_1","test1__xingpao_2","test1__xingpao_3"},n,n,self.name,nil,false)
      if table.contains(choices,"test1__xingpao_1") then
        room:drawCards(player,2,self.name)
      end
      if table.contains(choices,"test1__xingpao_2") then
        room:setPlayerMark(player,"@test1__xingpao_ju-turn","test1__xingpao_juli")
      end
      if table.contains(choices,"test1__xingpao_3") then
        room:setPlayerMark(player,"@test1__xingpao_xy-turn","test1__xingpao_xiangyin")
      end
    end
    n = 3 - n
    local hf = U.getDefaultTargets(player,Fk:cloneCard("fire__slash"))
    if n > 0 and hf and #hf > 0 then
      room:setPlayerMark(player,"test1__xingpao_mb-phase",n-1)
      U.askForUseVirtualCard(room,player,"fire__slash",nil,self.name,"#test1__xingpao-ask:::"..n,false)
    end
  end,
}

local xingpao_trigger = fk.CreateTriggerSkill{
  name = "#test1__xingpao_trigger",
  mute = true,
  events = {fk.TargetSpecified},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(xingpao) and 
    player:getMark("@test1__xingpao_xy-turn") ~= 0
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    data.disresponsive = true
  end,
}

local xingpao_mubiao = fk.CreateTargetModSkill{
  name = "#test1__xingpao_mubiao",
  mute = true,
  bypass_distances =  function(self, player, skill)
    return skill.trueName == "slash_skill" and player:getMark("@test1__xingpao_ju-turn") ~= 0
  end,
  extra_target_func = function(self, player, skill, card)
    if player:hasSkill(xingpao.name) and card.skillName == xingpao.name then
      return player:getMark("test1__xingpao_mb-phase")
    end
  end,
}

local zhuji = fk.CreateTriggerSkill{
  name = "test1__zhuji",
  events ={fk.Damage},
  can_trigger = function(self, event, target, player, data)
      return player:hasSkill(self.name) and 
      data.from and data.from.phase ~= Player.Play and
      player:usedSkillTimes(self.name) == 0 and
      not data.to:isNude()
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askForSkillInvoke(player,self.name,nil,"#test1__zhuji:"..data.to.id)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
      local c = room:askForCardChosen(player,data.to,"he",self.name,"#test1__zhuji-dis:"..data.to.id)
      if c ~= nil then
        room:throwCard(c,self.name,data.to,player)
      end
  end,
}
xingpao:addRelatedSkill(xingpao_trigger)
xingpao:addRelatedSkill(xingpao_mubiao)
jizi:addSkill(xingpao)
jizi:addSkill(zhuji)

Fk:loadTranslationTable{
  ["test1__jizi"] = "姬子",--名字
  ["#test1__jizi"] = "群星的探险家",--称号
  ["designer:test1__jizi"] = "zuozhe",--作者
  ["cv:test1__jizi"] = "cv",--cv
  ["illustrator:test1__jizi"] = "huashi",--画师
  
  ["test1__xingpao"] = "星炮",
  [":test1__xingpao"] = "准备阶段，你可以弃置任意张（至多为3）牌后执行等量项：1.摸两张牌；2.本回合使用牌无视距离；3.本回合使用牌不可被响应。然后视为使用一张目标数至多为未执行项数的火【杀】。",
  ["test1__zhuji"] = "逐击",
  [":test1__zhuji"] = "每回合限一次，当一名角色不于出牌阶段内造成伤害后，你可以弃置受伤角色的一张牌。",
 
  ["#test1__zhuji"] = "逐击：你可以弃置%src一张牌",
  ["#test1__zhuji-dis"] = "逐击：弃置%src一张牌",

  ["test1__xingpao-turn"] = "星炮",
  ["#test1__xingpao"] = "星炮：你可以弃置至多三张牌",
  ["#test1__xingpao-ask"] = "星炮：视为使用一张目标数至多为%arg的火【杀】",
  ["test1__xingpao_1"] = "摸两张牌",
  ["test1__xingpao_2"] = "本回合使用牌无视距离",
  ["test1__xingpao_3"] = "本回合使用牌不可被响应",
  ["@test1__xingpao_ju-turn"] = "星炮",
  ["@test1__xingpao_xy-turn"] = "星炮",
  ["test1__xingpao_mb-phase"] = "星炮",
  ["test1__xingpao_juli"] = "无视距离",
  ["test1__xingpao_xiangyin"] = "无法响应",
  
  ["#test1__xingpao_trigger"] = "星炮",
  ["#test1__xingpao_mubiao"] = "星炮",
  

  ["$test1__xingpao1"] = "战斗是一场精密的设计。",
  ["$test1__xingpao2"] = "下一次可就没那么简单了。",
  ["$test1__zhuji1"] = "逃不掉的！",
  ["$test1__zhuji2"] = "燃尽吧。",

  ['~test1__jizi'] = '明明…才刚开始……',
}

local waerte = General:new(extension, "test1__waerte", "test_xu", 3)

local duanjie = fk.CreateTriggerSkill{
  name = "test1__duanjie",
  events ={fk.Damage},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and data.from and data.from == player and
    player:usedSkillTimes(self.name,Player.HistoryRound) == 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local n = false
    room.logic:getEventsOfScope(GameEvent.MoveCards, 1, function(e)
      for _, move in ipairs(e.data) do
        if move.from and move.from == data.to.id then
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip then
              n = true
            end
          end
        end
      end
    end, Player.HistoryTurn)
    return n and room:askForSkillInvoke(player,self.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local use = U.askForUseVirtualCard(room,player,"slash",nil,self.name,"#test1__duanjie-ask::"..data.to.id)
    if use == nil then
      data.to:turnOver()
      room:setPlayerMark(player,"@test1__duanjie","#test1__duanjie-tiao")
    end
  end,
}

local duanjie_Trigger = fk.CreateTriggerSkill{
  name = "#test1__duanjie_Trigger",
  anim_type = "negative",
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and player.phase == Player.Draw and player:getMark("@test1__duanjie") ~= 0
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    player.room:setPlayerMark(player,"@test1__duanjie",0)
    return true
  end,
}

local niyuan = fk.CreateTriggerSkill{
  name = "test1__niyuan",
  events ={fk.TargetConfirming},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and not player.room:getPlayerById(data.to):isNude() and ((data.card.is_damage_card and data.card.color == Card.Black) or data.card:isVirtual())
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player,self.name,nil,"#test1__niyuan::"..data.to)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local t = room:getPlayerById(data.to)
    local c = Fk:getCardById(room:askForCardChosen(player,t,"he",self.name,"#test1__niyuan-cz::"..data.to))
    room:recastCard({c.id},t, self.name)
    room:setPlayerMark(t,"@test1__niyuan-phase",c.number)
    local sj = room.logic:getCurrentEvent():findParent(GameEvent.UseCard).parent
    room:setPlayerMark(player,"test1__niyuan-phase",sj.id)
  end,
  refresh_events = {fk.CardUseFinished},
  can_refresh = function (self, event, target, player, data)
    return player:getMark("test1__niyuan-phase") == player.room.logic:getCurrentEvent().parent.id
  end,
  on_refresh = function (self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player,"test1__niyuan-phase",0)
    for _, t in ipairs(room.players) do
      room:setPlayerMark(t,"@test1__niyuan-phase",0)
    end
  end,
}

local niyuan_prohibit = fk.CreateProhibitSkill{
  name = "#test1__niyuan_prohibit",
  prohibit_use = function(self, player, card)
    return player:getMark("@test1__niyuan-phase") > 0 and
    card.number < player:getMark("@test1__niyuan-phase")
  end,
  prohibit_response = function(self, player, card)
    return player:getMark("@test1__niyuan-phase") > 0 and
    card.number < player:getMark("@test1__niyuan-phase")
  end,
}

duanjie:addRelatedSkill(duanjie_Trigger)
waerte:addSkill(duanjie)
niyuan:addRelatedSkill(niyuan_prohibit)
waerte:addSkill(niyuan)

Fk:loadTranslationTable{
  ["test1__waerte"] = "瓦尔特",--名字
  ["#test1__waerte"] = "以世界之名",--称号
  ["designer:test1__waerte"] = "zuozhe",--作者
  ["cv:test1__waerte"] = "cv",--cv
  ["illustrator:test1__waerte"] = "huashi",--画师
  
  ["test1__duanjie"] = "断界",
  [":test1__duanjie"] = "每轮限一次，当你对一名本回合失去过牌的角色造成伤害后，你可以选择一项：1.其翻面且你跳过下个摸牌阶段；2.视为使用一张【杀】。",
  ["test1__niyuan"] = "拟渊",
  [":test1__niyuan"] = "当一名角色使用虚拟或黑色伤害牌指定目标时，你可以重铸目标一张牌，然后目标角色不能使用或打出点数小于该重铸牌的手牌直到此牌结算完成。",
 
  ["#test1__duanjie_Trigger"] = "断界",
  ["@test1__duanjie"] = "断界",
  ["#test1__duanjie-tiao"] = "跳过出牌",
  ["#test1__duanjie-ask"] = "断界：你可以视为使用一张【杀】，或取消后令%dest翻面且你跳过下个摸牌阶段",

  ["@test1__niyuan-phase"] = "拟渊",
  ["#test1__niyuan"] = "拟渊：你可以重铸%dest一张牌，其不能使用或打出点数小于该重铸牌的手牌直到此牌结算完成",
  ["#test1__niyuan-cz"] = "拟渊：重铸%dest一张牌",

  ["$test1__duanjie1"] = "见识一下星辰粉碎的样子吧！",
  ["$test1__duanjie2"] = "现在离开还来得及。",
  ["$test1__niyuan1"] = "这份力量的沉重，你一无所知。",
  ["$test1__niyuan2"] = "生存还是毁灭，你别无选择。",


  ['~test1__waerte'] = '交给…你们了……',
}

local buluoniya = General:new(extension, "test1__buluoniya", "test_xie", 3,4, General.Female)

local fy = function (t)
  if t == "phase_draw" then
    return "摸牌"
  elseif t == "phase_play" then
    return "出牌"
  elseif t == "phase_discard" then
    return "弃牌"
  end
  return t
end

local haoling = fk.CreateTriggerSkill{
  name = "test1__haoling",
  events ={fk.EventPhaseStart},
  can_trigger = function(self, event, target ,player, data)
    return player:hasSkill(self) and target.phase == Player.Start and
    player:getMark("@test1__haoling-round") == 0
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askForSkillInvoke(player,self.name,nil,"#test1__haoling-ask::"..target.id)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:loseHp(player,1,self.name)
    if not player.dead then
      local all = {"phase_draw","phase_play","phase_discard"}
      if player:getMark("test1__haoling") ~= 0 then
        table.removeOne(all,player:getMark("test1__haoling"))
        room:setPlayerMark(player,"test1__haoling",0)
        room:setPlayerMark(player,"@test1__haoling",0)
      end
      local list = {}
      local n = player:getLostHp()
      for i = 1, math.min(n,3), 1 do
        if i > (n - 1) then
          table.insertIfNeed(all,"Cancel")
        end
        local choice = player.room:askForChoice(player,all,self.name,("#test1__haoling::"..target.id..":"..math.min(n-1,3)..":"..math.min(n,3)..":"..i))
        if choice == "Cancel" then break
        else
          table.insert(list,choice)
          table.removeOne(all,choice)
        end
      end
      if #list == n then
        room:setPlayerMark(player,"@test1__haoling-round","#test1__haoling-nil")
      end
      if #list == 1 then
        room:setPlayerMark(player,"test1__haoling",list[1])
        room:setPlayerMark(player,"@test1__haoling",Fk:translate("#test1__haoling-jin")..fy(list[1]))
      end
      if not target.dead and #list > 0 then
        local sx = ""
        local p = {}
        for i, v in ipairs(list) do
          table.insert(p,i,Util.PhaseStrMapper(v))
          sx = sx .. fy(list[i])
          if i < #list then sx = sx .."|" end
        end
        room:setPlayerMark(target,"@test1__haoling-turn",sx == "" and 0 or sx)
        target:gainAnExtraTurn(false,self.name,{reason = self.name, phase_table = p})
      end
    end
  end,
}

local junshi = fk.CreateTriggerSkill{
  name = "test1__junshi",
  frequency = Skill.Compulsory,
  anim_type = "support",
  events = {fk.Damage},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and player:usedSkillTimes(self.name) == 0 and player:isWounded()
    and data.from and data.from:insideExtraTurn()
  end,
  on_use = function(self, event, target, player, data)
    player.room:recover({who = player,num = 1,skillName = self.name})
  end,
}

buluoniya:addSkill(haoling)
buluoniya:addSkill(junshi)

Fk:loadTranslationTable{
  ["test1__buluoniya"] = "布洛妮娅",--名字
  ["#test1__buluoniya"] = "大守护者",--称号
  ["designer:test1__buluoniya"] = "zuozhe",--作者
  ["cv:test1__buluoniya"] = "cv",--cv
  ["illustrator:test1__buluoniya"] = "huashi",--画师
  
  ["test1__haoling"] = "号令",
  [":test1__haoling"] = "每个角色的回合开始时，你可失去一点体力，然后令其执行一个额外回合，此回合的阶段改为你从摸牌、出牌、弃牌中选择至少X-1、至多X项，且你可以任意排序（X为你已损失的体力值）；若你选择了X项/仅1项，本轮此技能失效/下次选择时不可包含该项。",
  ["test1__junshi"] = "军势",
  [":test1__junshi"] = "锁定技，每回合限一次，当一名角色于额外的回合造成伤害后，你回复一点体力。",
 
  ["@test1__haoling-round"] = "号令",
  ["@test1__haoling"] = "号令",
  ["@test1__haoling-turn"] = "号令",

  ["#test1__haoling-nil"] = "本轮失效",
  ["#test1__haoling-jin"] = "禁选",
  ["#test1__haoling"] = "号令：%dest获得由你排序且只有%arg~%arg2个阶段的额外回合，请选择第%arg3个阶段",
  ["#test1__haoling-ask"] = "号令：是否令%dest获得由你排序阶段的额外回合",
  
  ["$test1__haoling1"] = "强敌当前，及时调整战略。",
  ["$test1__haoling2"] = "你会为此付出代价。",
  ["$test1__haoling3"] = "必须抓住这次机会。",
  ["$test1__haoling4"] = "时不再至，请助我一臂之力！",
  ["$test1__junshi1"] = "将我们所失去的，全部夺回。",
  ["$test1__junshi2"] = "援助来得很及时。",


  ['~test1__buluoniya'] = '绝对…不能失守……',
}

local peila = General:new(extension, "test1__peila", "test_xu", 3,3, General.Female)

local tongjie = fk.CreateTriggerSkill{
  name = "test1__tongjie",
  events ={fk.TargetConfirming},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and data.card.is_damage_card and
    player:usedSkillTimes(self.name) == 0 and player:getHandcardNum() > 0
  end,
  on_cost = function(self, event, target, player, data)
    local n = math.floor((player:getHandcardNum() / 2) + 0.5)
    local cards = player.room:askForCard(player,n, n,false,self.name,true,nil,"#test1__tongjie:::"..n..":"..Fk:translate(data.card.name))
    self.cost_data = {cards = cards}
    return #cards > 0
  end,
  on_use = function(self, event, target, player, data)
    player.room:throwCard(self.cost_data.cards,self.name,player,player)
    data.additionalDamage = (data.additionalDamage or 0) + 1
  end,
}

local fanghai = fk.CreateTriggerSkill{
  name = "test1__fanghai",
  events = {fk.AfterCardsMove},
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(self) then return end
    if not player:isKongcheng() then return end
    if player:getMark("@test1__fanghai-round") ~= 0 then return end
    for _, move in ipairs(data) do
      if move.from == player.id then
        for _, info in ipairs(move.moveInfo) do
          if info.fromArea == Card.PlayerHand then
            return true
          end
        end
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local tos = room:askForChoosePlayers(player, table.map(table.filter(room:getAlivePlayers(),function (p)
      return not p:isNude()
    end), Util.IdMapper), 1, 1, "#test1__fanghai", self.name)
    self.cost_data = {tos = tos}
    return #tos > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local t = room:getPlayerById(self.cost_data.tos[1])
    local c = Fk:getCardById(room:askForCardChosen(player,t,"he",self.name))
    room:throwCard(c,self.name,t,player)
    if c.sub_type == Card.SubtypeWeapon or c.trueName == "slash" then
      room:drawCards(player,1, self.name)
    else
      room:setPlayerMark(player,"@test1__fanghai-round","#test1__fanghai-nil")
    end
  end,
}

peila:addSkill(tongjie)
peila:addSkill(fanghai)

Fk:loadTranslationTable{
  ["test1__peila"] = "佩拉",--名字
  ["#test1__peila"] = "完全剖析",--称号
  ["designer:test1__peila"] = "zuozhe",--作者
  ["cv:test1__peila"] = "cv",--cv
  ["illustrator:test1__peila"] = "huashi",--画师
  
  ["test1__tongjie"] = "通解",
  [":test1__tongjie"] = "每回合限一次，当一名角色成为伤害牌的目标时，你可以弃置一半手牌（向上取整且至少为1）并令该牌伤害+1。",
  ["test1__fanghai"] = "妨害",
  [":test1__fanghai"] = "当你失去最后一张手牌后，你可以弃置任意角色的一张牌，若你弃置的是武器牌或【杀】，你摸一张牌，否则本轮此技能失效。",
 
  ["@test1__fanghai-round"] = "妨害",
  ["#test1__fanghai"] = "妨害：你可以弃置一名角色的一张牌",
  ["#test1__fanghai-nil"] = "失效",

  ["#test1__tongjie"] = "妨害：你可以弃置%arg张手牌令%arg2伤害+1",
  
  ["$test1__tongjie1"] = "敌方数据收集完毕。",
  ["$test1__tongjie2"] = "开始介入支援。",
  ["$test1__tongjie3"] = "侦察到敌方目标。",
  ["$test1__fanghai1"] = "收网标记激活。",
  ["$test1__fanghai2"] = "接下来，就是愉快的反击时间了。",


  ['~test1__peila'] = '失算了……',
}

local xiluwa = General:new(extension, "test1__xiluwa", "test_shi", 4,4, General.Female)

local yaogun = fk.CreateTriggerSkill{
  name = "test1__yaogun",
  events ={fk.Damage},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and not data.to.dead
  end,
  on_cost = function (self, event, target, player, data)
    return (player:getMark("test1__anke") > 0) or player.room:askForSkillInvoke(player,self.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player,"test1__anke",0)
    room:recover({
      who = data.to,
      num = data.to.maxHp - data.to.hp,
      skillName = self.name,
      recoverBy = player
    })
    for i = 1,data.to.hp, 1 do
      if data.to.dead or i > 3 then
        break
      end
      local pattern = ".|2~9|spade"
      local judge = {
        who = data.to,
        reason = "lightning",
        pattern = pattern,
      }
      for _, t in ipairs(room:getAlivePlayers()) do
        room:addPlayerMark(t,"@@test1__yaogun-phase")
        room:addPlayerMark(t, MarkEnum.UncompulsoryInvalidity.."-phase")
      end
      room:judge(judge)
      for _, t in ipairs(room:getAlivePlayers()) do
        room:removePlayerMark(t,"@@test1__yaogun-phase")
        room:removePlayerMark(t, MarkEnum.UncompulsoryInvalidity.."-phase")
      end
      if judge.card:matchPattern(pattern) then
        room:damage{
          to = data.to,
          damage = 3,
          damageType = fk.ThunderDamage,
          skillName = "lightning",
        }
        break
      end
    end
  end,
}

local anke = fk.CreateTriggerSkill{
  name = "test1__anke",
  frequency = Skill.Compulsory,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self) and player.phase == Player.Finish then
      local t = {}
      player.room.logic:getEventsOfScope(GameEvent.UseCard, 999, function(e)
        local use = e.data[1]
        if use.from == player.id then
          local targets = TargetGroup:getRealTargets(use.tos)
          if #targets > 0 then
            table.insertTableIfNeed(t,targets)
          end 
        end
      end, Player.HistoryTurn)
      self.cost_data = {t = t}
      return #t > 0
    end
  end,
  on_cost = function (self, event, target, player, data)
    return U.getDefaultTargets(player,Fk:cloneCard("thunder__slash"),true) ~= nil
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local t = self.cost_data.t
    for _, p in ipairs(room:getAlivePlayers()) do
      if U.getDefaultTargets(player,Fk:cloneCard("thunder__slash"),true) == nil then
        break
      end
      if table.contains(t,p.id) then
        table.removeOne(t,p.id)
        if room:askForSkillInvoke(p,self.name,nil,"#test1__anke:"..player.id) then
          U.askForUseVirtualCard(room,player,"thunder__slash",nil,self.name,nil,false)
        end
      end
    end
  end,
  refresh_events = {fk.Damage},
  can_refresh = function (self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and data.card and data.card.skillName == self.name
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:setPlayerMark(player,"test1__anke",1)
  end,
}

xiluwa:addSkill(yaogun)
xiluwa:addSkill(anke)

Fk:loadTranslationTable{
  ["test1__xiluwa"] = "希露瓦",--名字
  ["#test1__xiluwa"] = "摇滚机械师",--称号
  ["designer:test1__xiluwa"] = "zuozhe",--作者
  ["cv:test1__xiluwa"] = "cv",--cv
  ["illustrator:test1__xiluwa"] = "huashi",--画师
  
  ["test1__yaogun"] = "摇滚",
  [":test1__yaogun"] = "当你造成伤害后，你可以令目标将体力值回复至满，然后其进行其体力值数次【闪电】判定直到判定成功（至多三次），且此判定过程中全场非锁定技失效。",
  ["test1__anke"] = "安可",
  [":test1__anke"] = "锁定技，结束阶段，本回合成为过你牌的目标的角色依次选择是否令你视为使用一张雷【杀】，这些雷【杀】造成伤害后强制触发“摇滚”。",
 

  ["@@test1__yaogun-phase"] = "摇滚",
  
  ["#test1__anke"] = "安可：是否令%src视为使用一张雷【杀】",

  ["$test1__yaogun1"] = "不管是反抗，摇摆，沉沦……",
  ["$test1__yaogun2"] = "准备好释放自己了么？",
  ["$test1__yaogun3"] = "这首歌，送给你的~",
  ["$test1__anke1"] = "接下来可是重头戏。",
  ["$test1__anke2"] = "捧场的人还不少。",
  ["$test1__anke3"] = "观众都等不及啦。",


  ['~test1__xiluwa'] = '演出…还没……',
}

local sangbo = General:new(extension, "test1__sangbo", "test_xu", 3,4)

local quantao = fk.CreateTriggerSkill{
  name = "test1__quantao",
  frequency = Skill.Compulsory,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and player.phase == Player.Draw and not player:isKongcheng()
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local t = table.filter(room:getOtherPlayers(player),function (p)
      return player:canPindian(p) and not table.contains(player:getTableMark(self.name),p.id)
    end)
    if #t > 0 then
      local p = room:askForChoosePlayers(player,table.map(t,Util.IdMapper),1,1,"#test1__quantao",self.name,false)
      self.cost_data = {p = p[1]}
      return #p > 0
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local p = room:getPlayerById(self.cost_data.p)
    local pindian = player:pindian({p}, self.name)
    if pindian.results[p.id].winner == player then
      local n = math.min((pindian.fromCard.number - pindian.results[p.id].toCard.number),5)
      if n > 0 then
        room:drawCards(player,n,self.name)
      end
    else
      room:recover({who = player,num = 1,skillName = self.name,recoverBy = player})
    end
    room:addTableMark(player,self.name,p.id)
    return true
  end,
}

local jiaqian = fk.CreateTriggerSkill{
  name = "test1__jiaqian",
  events ={fk.Damage,fk.Damaged},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and not player.dead and player:usedSkillTimes(self.name,Player.HistoryRound) == 0
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    --[[
    local t = table.filter(room:getAlivePlayers(),function (p)
      return not table.contains(player:getTableMark(self.name),p.id)
    end)
    if #t > 0 then
      local p = room:askForChoosePlayers(player,table.map(t,Util.IdMapper),1,1,"#test1__jiaqian",self.name)
      if #p > 0 then
        self.cost_data = {p = p[1]}
        return true
      end
    end--]]
    local p = room:askForChoosePlayers(player,table.map(room:getAlivePlayers(),Util.IdMapper),1,1,"#test1__jiaqian",self.name)
    if #p > 0 then
      self.cost_data = {p = p[1]}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local p = room:getPlayerById(self.cost_data.p)
    room:addTableMark(player,self.name,p.id)
    room:drawCards(p,2,self.name)
  end,
}

local hantui = fk.CreateTriggerSkill{
  name = "test1__hantui",
  frequency = Skill.Compulsory,
  events = {fk.DamageInflicted},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and not player.dead and
    data.to == player and player:usedSkillTimes(jiaqian.name,Player.HistoryGame) > 1 and
    data.from and not table.contains(player:getTableMark(jiaqian.name),data.from.id)
  end,
  on_use = function(self, event, target, player, data)
    data.damage = data.damage + 1
  end,
}
sangbo:addSkill(quantao)
sangbo:addSkill(jiaqian)
sangbo:addSkill(hantui)

Fk:loadTranslationTable{
  ["test1__sangbo"] = "桑博",--名字
  ["#test1__sangbo"] = "地下行商",--称号
  ["designer:test1__sangbo"] = "zuozhe",--作者
  ["cv:test1__sangbo"] = "cv",--cv
  ["illustrator:test1__sangbo"] = "huashi",--画师
  
  ["test1__quantao"] = "圈套",
  [":test1__quantao"] = "锁定技，每名角色限一次，摸牌阶段，若你有手牌，你放弃摸牌并与一名角色拼点，若你赢，你摸点数差值张牌（至多为5）；若你没赢，你回复一点体力。",
  ["test1__jiaqian"] = "加钱",
  --[":test1__jiaqian"] = "每轮限一次，当你造成或受到伤害后，你可以令一名角色摸两张牌，每局游戏每名角色限一次。",
  [":test1__jiaqian"] = "每轮限一次，当你造成或受到伤害后，你可以令一名角色摸两张牌。",
  ["test1__hantui"] = "寒腿",
  [":test1__hantui"] = "锁定技，若你发动过一次以上“加钱”，本局游戏中未因“加钱”摸牌的角色对你造成的伤害+1。",
 
  ["#test1__jiaqian"] = "加钱：你可以令一名角色摸两张牌",
  
  ["#test1__quantao"] = "圈套：请与一名角色拼点",

  ["$test1__quantao1"] = "不冒点风险，又怎么尝得到甜头？",
  ["$test1__quantao2"] = "又有生意上门了。",
  ["$test1__quantao3"] = "我坚信，人与人之间美好的感情都是聊出来的。",
  ["$test1__jiaqian1"] = "顾客就是上帝~",
  ["$test1__jiaqian2"] = "想要我背叛上帝，除非…你加钱~",
  ["$test1__hantui1"] = "好家伙……",
  ["$test1__hantui2"] = "打、打人不打脸！",


  ['~test1__sangbo'] = '这下…赔大了… ',
}

local liaoqing = General:new(extension, "test1__liaoqing", "test_lie", 4)

local zhijian = fk.CreateTriggerSkill{
  name = "test1__zhijian",
  events ={fk.CardUsing},
  frequency = Skill.Compulsory,
  switch_skill_name = "test1__zhijian",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and player == target and 
    ((data.card.type == Card.TypeTrick and player:getSwitchSkillState(self.name) == fk.SwitchYang) or 
    (data.card.type == Card.TypeBasic and not data.card:isVirtual()--修改 非虚拟牌
    and player:getSwitchSkillState(self.name) == fk.SwitchYin))
  end,
  on_use = function(self, event, target, player, data)
    player.room:setPlayerMark(player,"@@test1__zhijian",player:getSwitchSkillState(self.name))
  end,
}

--- 获取玩家手牌上限。
---@return integer
local getMaxCards = function(self,name)
  local baseValue = math.max(self.hp, 0)

  local status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable
  local max_fixed = nil
  for _, skill in ipairs(status_skills) do
    if skill.name ~= name then--排除
      local f = skill:getFixed(self)
      if f ~= nil then
        max_fixed = max_fixed and math.max(max_fixed, f) or f
      end      
    end
  end

  if max_fixed then baseValue = math.max(max_fixed, 0) end

  for _, skill in ipairs(status_skills) do
    local c = skill:getCorrect(self)
    baseValue = baseValue + (c or 0)
  end

  return math.max(baseValue, 0)
end

local zhijian_maxcards = fk.CreateMaxCardsSkill{
  name = "#test1__zhijian_maxcards",
  main_skill = zhijian,
  fixed_func = function(self, player)
    if player:hasShownSkill(zhijian) and player:getSwitchSkillState(zhijian.name) == fk.SwitchYin then
      return getMaxCards(player,self.name) * 2
    end
  end
}

local zhijian_filter = fk.CreateFilterSkill{
  name = "#test1__zhijian_filter",
  anim_type = "defensive",
  card_filter = function(self, card, player)
    return player:hasSkill(zhijian) and player:getSwitchSkillState(zhijian.name) == fk.SwitchYin 
    and card.color == Card.Red
  end,
  view_as = function(self, card, player)
    local c = Fk:cloneCard("slash", card.suit, card.number)
    c.skillName = zhijian.name
    return c
  end,
}

local kuaiyu = fk.CreateTriggerSkill{
  name = "test1__kuaiyu",
  mute = true,
  events ={fk.TargetConfirming},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and target == player and data.from ~= player.id and
    player:usedSkillTimes(self.name,Player.HistoryRound) == 0 and
    table.find(player:getCardIds("h"),function (id)
      return Fk:getCardById(id).trueName == "slash"
    end) ~= nil
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local cards = room:askForCard(player,1,999,false,self.name,true,"slash","#test1__kuaiyu")
    self.cost_data = {cards = cards}
    return #cards > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(self.name,3)--3
    room:notifySkillInvoked(player, self.name)
    room:recastCard(self.cost_data.cards, player, self.name)
    local c = Fk:cloneCard("slash")
    local ts = c:getAvailableTargets(player,{bypass_distances = true})
    if #ts > 0 then
      local t = room:askForChoosePlayers(player,ts,1,#self.cost_data.cards,"#test1__kuaiyu-ask:::"..#self.cost_data.cards,self.name)
      if #t > 0 then
        player:broadcastSkillInvoke(self.name,(#t > 1) and 2 or 1)
        for _, p in ipairs(room:getOtherPlayers(player)) do
          if table.contains(t,p.id) then
            room:useVirtualCard("slash", nil, player, {p}, self.name, true)
          end
        end
      end
    end
    if room:askForSkillInvoke(player,self.name,nil,player:getSwitchSkillState(self.name,true) == fk.SwitchYang and "test1__zhijian-tl" or "test1__zhijian-jr") then
      room:useSkill(player,zhijian,function()
        return zhijian:use(event, target, player, data)
      end)
    end
  end,
}

zhijian:addRelatedSkill(zhijian_filter)
zhijian:addRelatedSkill(zhijian_maxcards)
liaoqing:addSkill(zhijian)
liaoqing:addSkill(kuaiyu)

Fk:loadTranslationTable{
  ["test1__liaoqing"] = "彦卿",--名字
  ["#test1__liaoqing"] = "剑胎武骨",--称号
  ["designer:test1__liaoqing"] = "zuozhe",--作者
  ["cv:test1__liaoqing"] = "cv",--cv
  ["illustrator:test1__liaoqing"] = "huashi",--画师
  
  ["test1__zhijian"] = "智剑",
  --[":test1__zhijian"] = "锁定技，转换技，阳：当你使用锦囊牌后，进入“智剑”；阴：当你使用基本牌后，脱离“智剑”；进入“智剑”后，你的手牌上限翻倍且所有红色手牌均视为【杀】。",
  [":test1__zhijian"] = "锁定技，转换技，阳：当你使用锦囊牌后，进入“智剑”；阴：当你使用非虚拟基本牌后，脱离“智剑”；进入“智剑”后，你的手牌上限翻倍且所有红色手牌均视为【杀】。",
  ["test1__kuaiyu"] = "快雨",
  [":test1__kuaiyu"] = "每轮限一次，当你成为其他角色使用牌的目标时，你可以重铸任意张【杀】并选择至多等量名角色，依次视为对这些角色使用【杀】，然后你可以转换“智剑”。",
 
  ["#test1__kuaiyu"] = "快雨：你可以重铸任意张【杀】并视为使用【杀】",
  ["#test1__kuaiyu-ask"] = "快雨：你可以依次视为对至多%arg名角色使用【杀】",

  ["#test1__zhijian_filter"] = "智剑",
  ["@@test1__zhijian"] = "智剑",
  ["test1__zhijian-jr"] = "快雨：你可以进入“智剑”",
  ["test1__zhijian-tl"] = "快雨：你可以脱离“智剑”",
  

  ["$test1__zhijian1"] = "哼，不过一合之敌。",
  ["$test1__zhijian2"] = "强者当前，不吝赐教。",
  ["$test1__zhijian3"] = "哦？你能接我几招？",
  ["$test1__zhijian4"] = "剑形如水，不可久驻。",
  ["$test1__kuaiyu1"] = "剑，随我心。",
  ["$test1__kuaiyu2"] = "万剑，天来！",
  ["$test1__kuaiyu3"] = "试探就到此为止了。",


  ['~test1__liaoqing'] = '辜负了…手中三尺……',
}


local guinaifen = General:new(extension, "test1__guinaifen", "test_xu", 3)

local suishi = fk.CreateActiveSkill{
  name = "test1__suishi",
  prompt = "#test1__suishi",
  anim_type = "support",
  card_num = 1,
  target_num = 1,
  card_filter = function(self, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).sub_type == Card.SubtypeArmor
  end,
  target_filter = function(self, to_select, selected, selected_cards)
    return #selected == 0 and #selected_cards == 1 and to_select ~= Self.id and
    Fk:currentRoom():getPlayerById(to_select):canMoveCardIntoEquip(selected_cards[1])
  end,
  on_use = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    local target = room:getPlayerById(effect.tos[1])
    room:moveCardIntoEquip(target, effect.cards[1], self.name, true, player)
  end,
}

local suishi_damage = fk.CreateTriggerSkill{
  name = "#test1__suishi_damage",
  anim_type = "offensive",
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
   return target == player and player:hasSkill(self) and data.card and data.card.trueName == "slash" and data.to:getEquipment(Card.SubtypeArmor)
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    data.damage = data.damage + 1
  end,
}

local suishi_zhong = fk.CreateTriggerSkill{
  name = "#test1__suishi_zhong",
  anim_type = "offensive",
  events = {fk.TargetSpecified},
  can_trigger = function(self, event, target, player, data)
    if not (target == player and player:hasSkill(self) and data.card.trueName == "slash") then return end
    return player.room:getPlayerById(data.to):getEquipment(Card.SubtypeArmor)
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    data.disresponsiveList = data.disresponsiveList or {}
    table.insert(data.disresponsiveList, data.to)
  end,
}

local paozhang = fk.CreateTriggerSkill{
  name = "test1__paozhang",
  mute = true,
  anim_type = "offensive",
  frequency = Skill.Compulsory,
  events = {fk.AfterCardsMove},
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(self) then return false end
    for _, move in ipairs(data) do
      if move.toArea == Card.PlayerSpecial and move.skillName == "test1__paozhang-cards" then
        self.cost_data = {p = move.proposer}
        local c = player:getPile("test1__paozhang")
        if #c > 0 then--避免一次有两张牌进入炮仗牌时报错
          return Fk:getCardById(c[1]).number == #player:getPile("test1__paozhang-cards")
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:moveCardTo(player:getPile("test1__paozhang"), Card.DiscardPile, nil, fk.ReasonJustMove, "test1__paozhang","test1__paozhang",true,player.id)
    player:broadcastSkillInvoke(self.name,math.random(4,5))
    room:notifySkillInvoked(player, self.name,nil,{self.cost_data.p})
    if self.cost_data.p == player.id then
      local cs = room:askForCard(player,1,3,false,"test1__paozhang",true,".|.|.|^(hand,equip)|.|.|.","#test1__paozhang-xuan","test1__paozhang-cards")
      if #cs > 0 then
        player:broadcastSkillInvoke(self.name,6)
        room:notifySkillInvoked(player, self.name,"masochism")
        room:obtainCard(player,cs,true,fk.ReasonJustMove,player.id,"test1__paozhang")
      end
    end
    room:moveCardTo(player:getPile("test1__paozhang-cards"), Card.DiscardPile, nil, fk.ReasonJustMove, "test1__paozhang","test1__paozhang-cards",true,player.id)
    --room:setPlayerMark(player,"@test1__paozhang",0)
    room:damage({
      who = player,
      to = room:getPlayerById(self.cost_data.p),
      damage = 2,
      damageType = fk.FireDamage,
      skillName = "test1__paozhang",
    })
  end,
  on_lose = function (self, player, is_death)
    if #player:getPile("test1__paozhang-cards") then
      player.room:moveCardTo(player:getPile("test1__paozhang-cards"), Card.DiscardPile, nil, fk.ReasonJustMove, "test1__paozhang","test1__paozhang-cards",true,player.id)
      player.room:moveCardTo(player:getPile("test1__paozhang"), Card.DiscardPile, nil, fk.ReasonJustMove, "test1__paozhang","test1__paozhang",true,player.id)
    end
  end,
}

local paozhang_1 = fk.CreateTriggerSkill{
  name = "#test1__paozhang_1",
  frequency = Skill.Compulsory,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and player.phase == Player.Start and #player:getPile("test1__paozhang") == 0
  end,
  on_use = function(self, event, target, player, data)
    player:broadcastSkillInvoke(paozhang.name,1)
    local room = player.room
    local c = room:getNCards(1)[1]
    --room:setPlayerMark(player,"@test1__paozhang",Fk:getCardById(c).number)
    player:addToPile("test1__paozhang",c,true,"test1__paozhang",player.id)
  end,
}

local paozhang_2 = fk.CreateTriggerSkill{
  name = "#test1__paozhang_2",
  frequency = Skill.Compulsory,
  events = {fk.AfterCardsMove},
  can_trigger = function(self, event, target, player, data)
    if (not player:hasSkill(self)) or (#player:getPile("test1__paozhang") == 0) then return false end
    local room = player.room
    local move_event = room.logic:getCurrentEvent()--当前时机
    local parent_event = move_event.parent--当前时机的父级时机
    local use_zu = {}
    local use_t = {}
    if parent_event ~= nil then
      if parent_event.event == GameEvent.UseCard then
        local parent_data = parent_event.data[1]--使用
        if parent_data.from ~= 0 then
          for _, id in ipairs(room:getSubcardsByRule(parent_data.card)) do
            table.insert(use_zu,{cid = id,from = parent_data.from})
          end
        end
      end
    end
    for _, move in ipairs(data) do
      if move.toArea == Card.DiscardPile and #use_zu > 0 then--使用进入弃牌堆
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.Processing then
              for _, v in ipairs(use_zu) do
                if v.cid == info.cardId then
                  table.insert(use_t,v)
                end
              end
            end
          end
      end
    end
    if #use_t > 0 then
      self.cost_data = {tcs = use_t}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    for _, p in ipairs(room:getAlivePlayers()) do
      for _, t in ipairs(self.cost_data.tcs) do
        if t.from == p.id then
          --player:broadcastSkillInvoke(paozhang.name,2)
          player:addToPile("test1__paozhang-cards",t.cid,true,"test1__paozhang-cards",p.id)
        end
      end
    end
  end,
}

local paozhang_3 = fk.CreateTriggerSkill{
  name = "#test1__paozhang_3",
  frequency = Skill.Compulsory,
  events = {fk.EventPhaseEnd},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and target.phase == Player.Finish and #player:getPile("test1__paozhang") > 0
  end,
  on_use = function(self, event, target, player, data)
    --player:broadcastSkillInvoke(paozhang.name,3)
    local room = player.room
    player:addToPile("test1__paozhang-cards",room:getNCards(1),true,"test1__paozhang-cards",target.id)
  end,
}



paozhang:addRelatedSkill(paozhang_1)
paozhang:addRelatedSkill(paozhang_2)
paozhang:addRelatedSkill(paozhang_3)
guinaifen:addSkill(paozhang)
suishi:addRelatedSkill(suishi_zhong)
suishi:addRelatedSkill(suishi_damage)
guinaifen:addSkill(suishi)


Fk:loadTranslationTable{
  ["test1__guinaifen"] = "桂乃芬",--名字
  ["#test1__guinaifen"] = "杂技艺人",--称号
  ["designer:test1__guinaifen"] = "zuozhe",--作者
  ["cv:test1__guinaifen"] = "cv",--cv
  ["illustrator:test1__guinaifen"] = "huashi",--画师

  ["test1__paozhang"] = "炮仗",
  [":test1__paozhang"] = "锁定技，准备阶段，若你没有“炮仗”，将牌堆顶的一张牌置于你的武将牌上称为“炮仗”；"..
  "当有牌因使用而进入弃牌堆时，使用者将此牌置于“炮仗”旁；"..
  "每回合结束时，当前回合角色须将牌堆顶的一张牌置于“炮仗”旁；"..
  "当“炮仗”旁的牌数等于“炮仗”的点数时，你弃置“炮仗”与“炮仗”旁的牌并对最后一名将牌置于“炮仗”旁的角色造成两点火焰伤害；"..
  "若该角色为你，你可以先获得“炮仗”旁的至多三张牌。",
  ["test1__suishi"] = "碎石",
  [":test1__suishi"] = "出牌阶段，你可以将一张防具牌置入一名其他角色的装备区，若其已有防具则替换之；有防具的角色：1.无法响应你的【杀】；2.你的【杀】对其造成的伤害+1。",

  ["#test1__paozhang_1"] = "炮仗",
  ["#test1__paozhang_2"] = "炮仗",
  ["#test1__paozhang_3"] = "炮仗",
  ["@test1__paozhang"] = "炮仗",
  ["test1__paozhang-cards"] = "炮仗牌",
  ["#test1__paozhang-xuan"] = "炮仗：你可以获得至多三张“炮仗”牌",

  ["#test1__suishi_damage"] = "碎石",
  ["#test1__suishi_zhong"] = "碎石",
  ["#test1__suishi"] = "碎石：你可以将一张防具牌置入一名其他角色的装备区，若其已有防具则替换之",

  ["$test1__paozhang1"] = "有钱的捧个钱场！",
  ["$test1__paozhang2"] = "没钱的下次一定！",
  ["$test1__paozhang3"] = "瞧一瞧看一看了哎！",
  ["$test1__paozhang4"] = "恭喜发财！",
  ["$test1__paozhang5"] = "花开富贵！",
  ["$test1__paozhang6"] = "幸亏我练过…",

  ["$test1__suishi1"] = "慌什么，来的都是客！",
  ["$test1__suishi2"] = "本次演出大获成功！",


  ['~test1__guinaifen'] = '哎呀，演砸了…',
}

return extension